package lion.framework.core.json.handler;

import java.io.IOException;
import java.io.Writer;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

import lion.framework.core.json.anno.JsonHandler;
import lion.json.IJsonHandler;

/**
 * @author lion
 * @email hl_0074@sina.com
 * @date 2015年12月3日
 */
@JsonHandler(LocalTime.class)
public class LocalTimeHandler implements IJsonHandler {

	private DateTimeFormatter formater = DateTimeFormatter.ofPattern("HH:mm:ss");

	@Override
	public void handle(Object datetime, Writer writer) throws IOException {

		writer.write("\"" + ((LocalTime) datetime).format(formater) + "\"");
	}

}
